<extend name="Layout/ins_popup" />
<block name="content">	
	{:W('PageHeader/popup',array('name'=>'新建系统参数','search'=>'N'))}
	<div class="row">
		<div class="col-xs-12">
			<form id="form_data" name="form_data" method="post" class="well form-horizontal clearfix">
				<input type="hidden" name="ajax" id="ajax" value="1">
				<input type="hidden" name="opmode" id="opmode" value="add">				
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="code">编码*：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="code" name="code" check="require" msg="请输入编码">
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="name">名称*：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="name" name="name" check="require" msg="请输入名称">
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="val">数据*：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="val" name="val" check="require" msg="请输入数据">
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="pid_name">父级*：</label>
					<div class="col-xs-9">
						<div class="input-group">
							<input name="pid_name" class="form-control" id="pid_name" type="text" readonly="readonly" msg="请选择父级" check="require"/>
							<input name="pid" id="pid" type="hidden" msg="请选择父级" check="require" />
							<span class="input-group-btn">
								<button class="btn btn-sm btn-primary" onclick="select_pid()" type="button">
									选择
								</button> </span>
						</div>
					</div>
				</div>				
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="sort">排序：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="sort" name="sort" >
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="is_del">状态*：</label>
					<div class="col-xs-9">
						<select   name="is_del" id="is_del" class="form-control">
							<option  value="0">启用</option>
							<option value="1">禁用</option>
						</select>
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="remark" >其他：</label>
					<div class="col-xs-9" >
						<textarea class="form-control" name="remark" id="remark" rows="5" class="col-xs-12" ></textarea>
					</div>
				</div>
			</form>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		function save() {
			if (check_form("form_data")) {
				var vars = $("#form_data").serialize();
				sendAjax("{:U('save')}", vars, function(data) {
					if (data.status) {
						ui_alert(data.info, function() {
							parent.location.reload(true);
							myclose();
						});
					}else{
						ui_error(data.info);
					}
				});
			}
		}

		function select_pid() {
			winopen("{:U('winpop')}", 730, 560);
		}
		
		$(document).ready(function() {
			$pid = $("#id", parent.document).val();
			$("#pid").val($pid);
		});
	</script>

</block>